package task

import (
	"fmt"
	"time"
)

type TestTask struct {
	BasicTask
}

func (task *TestTask) start() {
	task.BasicTask.start()
	defer task.BasicTask.finish()

	total := 100
	for i := 0; i <= total; i++ {
		task.progress = fmt.Sprintf("%d / %d", i, total)
		time.Sleep(time.Millisecond * 50)
		if !task.isRunning() {
			break
		}
	}
}

func NewTestTask() *TestTask {
	return &TestTask{
		BasicTask: newBasicTask("test"),
	}
}
